import axios from '@/utils/axios'

const addOrgApi = '/sp_admin/org/add' // 新增机构
const orgTreeApi = '/sp_admin/org/tree' // 机构tree
const updateOrgApi = '/sp_admin/org/update' // 新增
const delOrgApi = '/sp_admin/org/remove' // 删除

/**
 * @desc 新增机构
 */
export const addOrg = ({ data }) => {
  return axios.post(addOrgApi, data)
}

/**
 * @desc 机构tree
 */
export const orgTree = () => {
  return axios.get(orgTreeApi)
}

/**
 * @desc 更新机构
 */
export const updateOrg = ({ data }) => {
  return axios.post(updateOrgApi, data)
}

/**
 * @desc 删除机构
 */
export const delOrg = ({ params }) => {
  return axios({
    url: delOrgApi,
    method: 'delete',
    params: params
  })
}
